
#include "ReadRecessionVelocityBC.h"
#include "Function.h"

registerMooseObject("TrilobitaApp", ReadRecessionVelocityBC);
template<>
InputParameters validParams<ReadRecessionVelocityBC>()
{
  InputParameters params = validParams<NodalBC>();
  MooseEnum component("x y z");
  params.addRequiredParam<MooseEnum>("component", component, "The desired component of velocity.");
  params.addCoupledVar("vnx", "x-component of the velocity");
  params.addCoupledVar("vny", "y-component of the velocity");
  params.addCoupledVar("vnz", "z-component of the velocity");
  params.addCoupledVar("variableold", "variable");
  return params;
}

ReadRecessionVelocityBC::ReadRecessionVelocityBC(const InputParameters & parameters) :
    NodalBC( parameters),
	_component(getParam<MooseEnum>("component")),
	_vn_x(coupledValue("vnx")),
	_vn_y(coupledValue("vny")),
	_vn_z(coupledValue("vnz")),
	_oldu(coupledValueOld("variableold"))
{
}

Real
ReadRecessionVelocityBC::computeQpResidual()
{
	if (_component == 0)
	{
		return _u[_qp]-_oldu[_qp]-_vn_x[_qp]*_dt;

	}
	else
	{
		if(_component == 1)
		{
			return _u[_qp]-_oldu[_qp]-_vn_y[_qp]*_dt;
		}
		else
		{
			return _u[_qp]-_oldu[_qp]-_vn_z[_qp]*_dt;

		}
	}
}




